<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'user-form',
    'enableClientValidation' => true,
        ));
?>
<table class="form" style="width: 100%">
    <tr>
        <td class="label required" style="width:160px">
            <label class="required"><?php echo t('LBL_NAME', 'user') ?> <span class="required">*</span></label>
        </td>
        <td class="input">
            <table>
                <tr>
                    <td class="input" style="width: 133px; padding-bottom: 0px; padding-left:0px;">
                        <?php echo $form->textField($model, 'first_name', array('style' => 'width:95px', 'placeholder' => 'First Name')); ?>
                        <?php echo $form->error($model, 'first_name'); ?>
                    </td>
                    <td class="input" style="padding-bottom: 0px; padding-left:0px;">
                        <?php echo $form->textField($model, 'last_name', array('style' => 'width:95px', 'placeholder' => 'Last Name')); ?>
                        <?php echo $form->error($model, 'last_name'); ?>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td class="label required"><?php echo $form->labelEx($model, 'username'); ?></td>
        <td class="input">
            <?php
            if (!isset($model->id))
                echo $form->textField($model, 'username', array('style' => 'width:230px'));
            else
                echo $form->textField($model, 'username', array('disabled' => 'disabled', 'style' => 'width:230px'));
            ?>
            <?php echo $form->error($model, 'username'); ?>
        </td>
    </tr>

    <tr>
        <td class="label required"><?php echo $form->labelEx($model, 'new_password'); ?></td>
        <td class="input" >
            <?php echo $form->passwordField($model, 'new_password', array('style' => 'width:230px')); ?>
            <?php echo $form->error($model, 'new_password'); ?>
        </td>
    </tr>
    <tr>
        <td class="label required"><?php echo $form->labelEx($model, 'new_password_repeat'); ?></td>
        <td class="input" >
            <?php echo $form->passwordField($model, 'new_password_repeat', array('style' => 'width:230px')); ?>
            <?php echo $form->error($model, 'new_password_repeat'); ?>
        </td>
    </tr>
    <tr>
        <td class="label required"><?php echo $form->labelEx($model, 'email'); ?></td>
        <td class="input" >
            <?php echo $form->textField($model, 'email', array('style' => 'width:230px')); ?>
            <?php echo $form->error($model, 'email'); ?>
        </td>
    </tr>
    <tr>
        <td class="label required"><?php echo $form->labelEx($model, 'active'); ?></td>
        <td class="checkbox">
            <?php
            $IsNewUser = $model->id == '';
            if ($IsNewUser == true) {
                echo $form->checkBox($model, 'active', array('align' => 'left'));
            } else {
                echo $form->checkBox($model, 'active', array('align' => 'left'));
            }
            ?>
        </td>
    </tr>
    <tr>
        <td ><?php echo $form->labelEx($model, 'auth_assignments'); ?></td>
        <td class="verticalCheckbox" colspan="2">
<?php
if (count($model->getAuth_Assignments()) > 0)
    $model->auth_assignments = $model->getAuth_Assignments();
echo $form->dropDownList($model, 'auth_assignments', AuthItem::model()->getNameByTypeForForm(AuthorizationType::ROLE), array('empty' => t('MSG_FIRST_ITEM_ROLE_NAME', 'messages'), 'style' => 'width:240px'));
?>
            <?php echo $form->error($model, 'auth_assignments'); ?>
        </td>
    </tr>
    <tr>
        <td colspan="2" class="cbutton">
<?php echo Html::buttonConfirm(t('BTN_SAVE'), 'statusConfirmed'); ?>
<?php echo Html::buttonConfirm(t('BTN_CANCEL'), 'statusCanceled', 'cancel'); ?>
        </td>
    </tr>
</table>    
<script type="text/javascript">LGCMS.addTooltip();</script>
<?php $this->endWidget(); ?>
